package com.dreamcode.anfeedreader.collectors;

import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dreamcode.anfeedreader.modelClass.Categories;

public class ItemListAdapter extends BaseAdapter{
	private List<Categories> categoryList = null;
	private Context ctx = null;
	public ItemListAdapter(Context ctx, List<Categories> categoryList){
		this.ctx = ctx;
		this.categoryList = categoryList;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return categoryList.size();
	}

	@Override
	public Object getItem(int pos) {
		// TODO Auto-generated method stub
		return categoryList.get(pos);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LinearLayout lView = new LinearLayout(ctx);
		lView.setId((categoryList.get(position)).getGroupId());
		/*RadioButton radioItem = new RadioButton(ctx);
		radioItem.setText((categoryList.get(position)).getGroupName());*/
		TextView tView = new TextView(ctx);
		tView.setText((categoryList.get(position)).getGroupName());
		tView.setTextColor(Color.BLACK);
		tView.setMinHeight(30);
		tView.setGravity(Gravity.CENTER_VERTICAL);
		lView.addView(tView);
		return lView;
	}

}
